home *** CD-ROM | disk | FTP | other *** search
- /* INT86.C --- p. 625 */
- #ifdef EXAMPLE_1
- #include <dos.h>
- #define BIOS_VIDEO 0x10
- void putcursor(int row, int col)
- {
- union REGS xr;
- xr.h.ah = 2; /* Function number to set cursor */
- xr.h.dh = row;
- xr.h.dl = col;
- xr.h.bh = 0; /* Assume video page 0 */
- /* Use xr for both input/output */
- int86(BIOS_VIDEO, &xr, &xr);
- }
- #endif
- #ifdef EXAMPLE_2
- #include <stdio.h>
- #include <dos.h>
- #define BIOS_PRNTSCR 5
- union REGS xr;
- main()
- {
- printf("test: Printing screen\n");
- int86(BIOS__PRNTSCR, &xr, &xr);
- }
- #endif
- #ifdef EXAMPLE_3
- #include <stdio.h>
- #include <dos.h>
- #define DOS_GETDATE 0x2a
- #define DOS_INT 0x21
- static char *months[] = { "---", "JAN", "FEB", "MAR", "APR",
- "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
- main()
- {
- union REGS xr, yr;
- xr.h.ah = DOS_GETDATE;
- int86 (DOS_INT, &xr, &yr);
- printf("Today's date is: %.2d-%s-%.4d\n",
- yr.h.dl, months[yr.h.dh], yr.x.cx);
- }
- #endif
- #include <stdio.h>
- #include <dos.h>
- static union REGS xr, yr;
- #define BIOS_VIDEO 0x10
- main()
- {
- /* Set up registers as needed by BIOS video function. */
- xr.h.ah = 0x12;
- xr.h.bl = 0x10;
- int86 (BIOS_VIDEO, &xr, &yr);
- /* Upon return values are in structure yr */
- if (yr.h.bh == 0) printf("EGA in color mode\n");
- if (yr.h.bh == 1) printf("EGA in mono mode\n");
- printf("Memory size: ");
- switch (yr.h.bl)
- {
- case 0: printf("64K\n");
- break;
- case 1: printf("128K\n");
- break;
- case 2: printf("192K\n");
- break;
- case 3: printf("256K\n");
- break;
- }
- }